home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_12
/
8n12093a
< prev
next >
Wrap
Text File
|
1990-10-07
|
726b
|
45 lines
Listing 4
------------------------ globals.h ------------------------------
#ifndef GLOBALS_H
#define GLOBALS_H
#ifdef DRIVER
#define CLASS
#define INIT (x) = x
#else
#define CLASS extern
#define INIT (x)
#endif
CLASS char date[9] INIT("01-01090");
#endif /* GLOBALS_H */
----------------------- file1.c ---------------------------------
#define DRIVER
#include "globals.h"
main()
{
strcpy(date, "01-01-90");
foo();
puts(date);
}
---------------------- file2.c ---------------------------------
#include "globals.h"
foo()
{
puts(date);
strcpy(date, "02-02-90");
puts(date);
}
----------------------------------------------------------------